package cosc617_blackteam;

import java.util.ArrayList;
import java.util.Iterator;

/**
 * @author Laura
 * Iterator that iterates through all tables
 */
public class DefaultTableIterator implements Iterator<Table> {
private ArrayList<Table> tables;
private int index;
	public DefaultTableIterator(ArrayList<Table> tables){
		this.tables = tables;
		index = 0;
	}
	@Override
	public boolean hasNext() {
		return (index < tables.size());
	}

	@Override
	public Table next() {
		Table output = null;
		if(hasNext())
			output = tables.get(index);
		index ++;
		return output;
		
	}

	@Override
	public void remove() {
		throw new UnsupportedOperationException();

	}

}
